﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using AutoRegisterManager.Inc;
using System.Xml;
using Skynet.Framework.Common;

namespace AutoRegisterManager
{
    public partial class FrmOfficeList : Form
    {
        public FrmOfficeList()
        {
            InitializeComponent();
            this.FormClosing += new FormClosingEventHandler(FrmOfficeList_FormClosing);
        }

        void officeList1_Paint(object sender, PaintEventArgs e)
        {
            this.top1.Sec = 60;
        }

        void FrmOfficeList_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.top1.timer1.Stop();
        }

        private void label1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        public void FrmOfficeList_Load(object sender, EventArgs e)
        {
            officeItem1.LblOffice.Text = "儿科";
            officeItem2.LblOffice.Text = "产科";
            officeItem3.LblOffice.Text = "妇科";
            officeItem4.LblOffice.Text = "内科";
            officeItem5.LblOffice.Text = "外科";
            officeItem6.LblOffice.Text = "口腔科";
            officeItem7.LblOffice.Text = "五官科";

            this.top1.AutoClose = true;
            this.top1.Sec = 120;
            this.top1.timer1.Start();

            this.lblName.Text = "Demo";
                this.lblAge.Text = "30";
          
         
            backgroundWorker1.RunWorkerAsync();
            backgroundWorker2.RunWorkerAsync();

        }
        //加载专家信息
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            //UsersFacade user = new UsersFacade();
            //DataSet ZjDoctor = user.FindClinicDoctor("专家", "");
            //if (ZjDoctor == null || ZjDoctor.Tables[0].Rows.Count <= 0)
            //{
            //    SkynetMessage.MsgInfo("加载专家信息失败");
            //    return;
            //}
            //e.Result = ZjDoctor;
        }

        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            DataSet ds = (DataSet)e.Result;
            //LkLoad(this.officeList1.lkOffice, ds);
        }

        private delegate void DeLkLoad(LookUpEdit lv, DataSet ds);
        //提示信息
        void LkLoad(LookUpEdit lv, DataSet ds)
        {
            if (!lv.InvokeRequired)
            {
                FrmMain.doctorData = ds;
                //this.officeList1.lkOffice.Properties.DataSource = ds.Tables[0].DefaultView;
            }
            else
            {
                // 多线程调用时，通过主线程去访问
                DeLkLoad de = LkLoad;
                this.Invoke(de, lv, ds);
            }
        }

        //加载科室信息
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            //OfficeFacade of = new OfficeFacade();
            //DataSet ds = of.QueryByOfficeType(28);
            //e.Result = ds;

        }

        private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            //this.officeList1.DtOffice = ((DataSet)e.Result).Tables[0];
            //this.officeList1.DataBind();
        }

        private void officeItem1_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

        private void officeItem2_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

        private void officeItem4_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

        private void officeItem5_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

        private void officeItem3_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

        private void officeItem6_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

        private void officeItem7_Click(object sender, EventArgs e)
        {
            Frmzhuanjia frm = new Frmzhuanjia();
            frm.ShowDialog();
        }

  
       
    }
}
